// rem换算函数
@function rem($pt, $base-font-size: 32) {
  @return ($pt / $base-font-size) * 1rem;
}

// 截断文本
@mixin text-overflow() {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

// 清除浮动方案一
@mixin clearfix() {
  &:before,
  &:after {
    display: table;
    content: '';
  }
  &:after {
    clear: both;
  }
}

// 使用flex布局使子元素居中
@mixin flex-center() {
  display: flex;
  justify-content: center;
  align-items: center;
}

@mixin rmb() {
  content: '¥';
}

@mixin border-t($color) {
  position: relative;
  &::before {
    content: '';
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    border-top: 1px solid $color;
  }
}

@mixin border-b($color) {
  position: relative;
  &::after {
    content: '';
    display: block;
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    border-top: 1px solid $color;
  }
}

@mixin border-l($color) {
  position: relative;
  &::before {
    content: '';
    display: block;
    position: absolute;
    left: 0;
    bottom: 0;
    height: 100%;
    border-left: 1px solid $color;
  }
}

@mixin border-r($color) {
  position: relative;
  &::after {
    content: '';
    display: block;
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    border-right: 1px solid $color;
  }
}

@mixin border-all($color, $radius: 10px) {
  position: relative;
  &:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    border: 1px solid $color;
    border-radius: $radius;
    transform-origin: top left;
  }
}

@mixin flex-scroll() {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

// 只有两行文字，超出部分使用省略号截断
@mixin two-rows() {
  overflow: hidden;
  text-overflow: ellipsis;
  /* autoprefixer: ignore next */
  display: -webkit-box;
  /* autoprefixer: ignore next */
  -webkit-box-orient: vertical;
  /* autoprefixer: ignore next */
  -webkit-line-clamp: 2;
}
